<template>
  <div id="top">
    <qianyuejilu @seaList="seaFn"></qianyuejilu>
    <br>
    <table2 :sea="list" ></table2>
  </div>
</template>

<script>
import qianyuejilu from '../../components/SignModel/qianyuejilu.vue'
import table2 from '../../components/SignModel/table2.vue'
import axios from 'axios'
axios.defaults.baseURL="http://localhost:8080"
export default {
 components: {
     qianyuejilu,
     table2
 },
 methods: {
   //搜索
   seaFn(value,value1,value2,value3,input2){
     axios({
        url: "/sign/getSignList2",
        method: "GET",
        
        params:{
          contract_state:value,
          sign_organization:value1,
          sign_team:value2,
          serve_page:value3,
          user_name:input2
        }
      }).then((res) => {
        this.list = res.data; //把值传到list里面
        console.log(res.data);
      });
   },
   queryList() {
      axios({
        url: "/sign/getSignList2",
        method: "GET",
      }).then((res) => {
        this.list = res.data; //把值传到list里面
        console.log(res.data);
      });
      if (window.localStorage.getItem("list") ) {
          this.$store.replaceState(Object.assign({}, this.$store.state,JSON.parse(window.localStorage.getItem("list"))))
      } 

window.addEventListener("beforeunload",()=>{
        window.localStorage.setItem("list",JSON.stringify(this.$store.state))
    })
    },
 },
 created () {
   this.queryList();
   document.querySelector('body').setAttribute('style', 'background-color:#F2F7FB')
 },
 data(){
   return{
     list:[],
   }
 }
}
</script>

<style>
*{
    padding: 0;
    margin: 0;
}
#top{
    width: 1150px;
    height: 1000px;
    background: white;
    margin: 20px auto;
    position: relative;
}

</style>